#coding=utf-8
import myutil
XT = []
class mm(object):
    def __init__(self,name="无名", HP=10):
        self.name = name
        self.HP = HP
        print(name + " 隆重登场....血量：" + str(HP))
        myutil._write("zhanbao.txt" , 'a' , name + " 隆重登场....血量：" + str(HP) + "\n" , "utf-8")
    def run(self,_hp):
        self._hp = _hp
        print( "\t****** 战报 *******" + self.name +  "掉了" + str(_hp) );
        myutil._write("zhanbao.txt", 'a', "\t****** 战报 *******" + self.name +  "掉了" + str(_hp) + "\n", "utf-8")
        if self.HP<=0:
            print("\t****** 战报 *******" + self.name, end="嗝屁了...\n")
            myutil._write("zhanbao.txt", 'a', "\t****** 战报 *******" + self.name + "嗝屁了...\n", "utf-8")
        # else:
            # print(self.name + "("+str(self.HP)+")"+ ">>> " + "敢打我？？？！！！看我的！！！！")
    def attack(self,jineng, obj , _hp):
        print("【"+self.name + "("+str(self.HP)+")"+ "】" + "向【"+obj.name+ "("+str(obj.HP)+")"+  "】出招>>>",jineng)
        myutil._write("zhanbao.txt", 'a', "【"+self.name + "("+str(self.HP)+")"+ "】" + "向【"+obj.name+ "("+str(obj.HP)+")"+  "】出招>>>" + jineng, "utf-8")
        obj.HP -= _hp
        obj.run(_hp)
